import request from "@/utils/request";

export function login(data) {
  return request({
    url: "/user/login?admin=admin",
    method: "post",
    data,
  });
}

export function reqAllUser() {
  return request({
    url: "/user/all",
    method: "get",
  });
}

export function reqRole() {
  return request({
    url: "/user/role",
    method: "get",
  });
}

// 添加新的分类或修改用户
export const reqAddOrUpdateUser = (data) => {
  if (data._id) {
    return request({
      url: "/user/info",
      method: "put",
      data,
    });
  } else {
    return request({ url: "/user/register", method: "post", data });
  }
};

export function reqDeleteUser(data) {
  return request({
    url: "/user",
    method: "delete",
    data,
  });
}

// export function getInfo(token) {
//   return request({
//     url: '/admin/acl/index/info',
//     method: 'get',
//     params: { token },
//   });
// }

// export function logout() {
//   return request({
//     url: '/admin/acl/index/logout',
//     method: 'post',
//   });
// }
